// ==UserScript==
// @name xy139.tishxinxi
// @author wgu
// @description  xy139
// @include http://xq.139life.com/jsdt/tishixinxi_wc.jsp
// ==/UserScript==
//var text=document.querySelectorAll('.red_b p')[0].textContent;

/*
//var pref = new GM_Pref('wgu.xq139life.');
var _t=JSON.parse(GM_getValue('_t'));
var j=0,l;

var f=parseInt(text.match(/\d+/)[0])/10;
console.log(f+':'+_t['q2'].length);

console.log('________________________________________');
for(j=0,l=_t['q2'].length;j<l;j++){
	console.log(_t['q2'][j])
}


if(f<=12){
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
	var exit=[];
	//xqDB.open();
	for(j=0,l=_t['q'].length;j<l;j++){
		console.log(",'"+_t['q'][j]+"'")	
		try {
			GM_exeSQL("DELETE FROM XQ3 WHERE q = '"+_t['q'][j].split('@')[0]+"';");
		}catch(e){ 
		} 	
	}
	//xqDB.close();
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
}else{

if((_t['q2'].length+f)<15){
	//alert('wrong');
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
	for(j=0,l=_t['q2'].length;j<l;j++){
		console.log(",'"+_t['q2'][j]+"'")	
	}
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
	console.log('________________________________________');
	//var xqDB= new GM_DB('XQ2.sqlite'),exit=[];
	//xqDB.open();
	for(j=0,l=_t['q'].length;j<l;j++){
		console.log(",'"+_t['q'][j]+"'")	
		//try {
		//	xqDB.exeSQL("DELETE FROM XQ WHERE q = '"+_t['q'][j].split('@')[0]+"';");
		//}catch(e){ 
		//} 	
	}
	//xqDB.close();
	console.log('________________________________________');
}


if(f<15&&(_t['q2'].length+f)==15){
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
	for(j=0,l=_t['q2'].length;j<l;j++){
		console.log(",'"+_t['q2'][j]+"'")	
	}
	console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
}


if((_t['q2'].length+f)<15){
	//alert('wrong');
	var q2=_t['q'];
	var xqDB= new GM_DB('XQ.sqlite'),exit=[];
	xqDB.open();
	for(j=0,l=q2.length;j<l;j++){
		try {
			var data=xqDB.getData("select * from XQ where q ='"+q2[j].split('@')[0]+"';",[0,1,1,1,1]);
			xqDB.exeSQL("update XQ set n="+(data[0][4]+1)+" where q='"+q2[j].split('@')[0]+"' ;");
		}catch(e){ 
			console.log(q2[j]);
		} 
	}
	xqDB.close();
}
if(f==15){
	var q2=_t['q2'];
	var xqDB= new GM_DB('XQ.sqlite');
	xqDB.open();
	for(j=0,l=q2.length;j<l;j++){
		try {
			var data=xqDB.getData("select * from XQ where q ='"+q2[j].split('@')[0]+"';",[0,1,1,1,1]);
			xqDB.exeSQL("update XQ set y="+(data[0][3]+1)+" where q='"+q2[j].split('@')[0]+"' ;");
		}catch(e){ 
			console.log(q2[j]);
		} 
	}
	
	q2=_t['q'];
	for(j=0,l=q2.length;j<l;j++){
		try {
			var data=xqDB.getData("select * from XQ where q ='"+q2[j].split('@')[0]+"';",[0,1,1,1,1]);
			xqDB.exeSQL("update XQ set y="+(data[0][3]+1)+" where q='"+q2[j].split('@')[0]+"' ;");
		}catch(e){ 
			console.log(q2[j]);
		} 
	}
	xqDB.close();
	console.log('DBA2');
}
console.log('________________________________________');
*/

window.parent.location.href='http://xq.139life.com/jsdt/index.jsp';